/**
 * Core script to handle the entire theme and core functions
 */
var ContentSidebar = function() {
	//阻止事件冒泡
	var stopPropagation = function(e) {
		if (e.stopPropagation)
			e.stopPropagation();
		else
			e.cancelBubble = true;
	}

	// 开合(右)侧边栏
	var handleQuickSidebarToggler = function() {
		// quick sidebar toggler
		$('.page-content-wrapper').click(function(e) {
			$('body').removeClass('page-quick-sidebar-open');
		});
		$('.glyphicon-edit').click(function(e) {
			stopPropagation(e);
			$('body').toggleClass('page-quick-sidebar-open');
		});
		$('.page-quick-sidebar-wrapper').click(function(e) {
			stopPropagation(e);
		});
	};

	return {

		init : function() {
			// layout handlers
			handleQuickSidebarToggler(); // handles quick sidebar's toggler
		},
		toggle:function(e){
			if(e){ stopPropagation(e); }
			console.info('....');
			$('body').toggleClass('page-quick-sidebar-open');
		}
	};

}();

if (App.isAngularJsApp() === false) {
	jQuery(document).ready(function() {
		ContentSidebar.init(); // init metronic core componets
	});
}